Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a 'join' func to the template engine #20

Merged
merged 1 commit into from
Dec 23, 2015

Conversation

mikepea
Copy link
Collaborator

@mikepea mikepea commented Dec 23, 2015

I needed this so that I can display JIRA labels in my 'list' template, but it should be generally useful.

Happy to have this pushed back for a more robust implementation with tests.

I needed this so that I can display JIRA labels in my 'list' template.
@mikepea mikepea closed this Dec 23, 2015
@mikepea mikepea reopened this Dec 23, 2015
@mikepea
Copy link
Collaborator Author

mikepea commented Dec 23, 2015

Note that to enable displaying labels in 'list' output, you need to append to queryfields:

queryfields: "summary,created,updated,priority,status,reporter,assignee,labels"

@coryb
Copy link
Contributor

coryb commented Dec 23, 2015

Looks good. An alternative to using join would be something like this:

labels: {{ range .fields.labels }}
  - {{ . }}{{end}}

and just iterate over the labels and print them out, one per line.
-Cory

coryb added a commit that referenced this pull request Dec 23, 2015
Add a 'join' func to the template engine
@coryb coryb merged commit 425b571 into go-jira:master Dec 23, 2015
@coryb
Copy link
Contributor

coryb commented Dec 23, 2015

Oh, I see, you wanted this for "list", I was thinking "view", so you obviously don't want to print multiline stuff in "list". So ignore my comment :)

Thanks,
-Cory

pdericson pushed a commit to pdericson/go-jira that referenced this pull request Sep 14, 2017
Add a 'join' func to the template engine
@lvh
Copy link

lvh commented Dec 6, 2018

Uh, how do I use this? I tried to do the following:

  - name: search
    help: search for text
    script: echo jira list --query='text ~ \"{{ join " " args.ARGS }}\"'
    args:
      - name: ARGS
        repeat: true

But got: ERROR Invalid Usage: template: gojira:1:45: executing "gojira" at <args>: wrong type for value; expected []interface {}; got []string

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants